

/****** Object:  Table [dbo].[Death]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Death](
	[KillerId] [int] NOT NULL,
	[VictimId] [int] NOT NULL,
	[WeaponId] [int] NOT NULL,
	[TimeOfDeath] [datetime] NOT NULL,
	[DeathId] [int] IDENTITY(1,1) NOT NULL,
	[GameId] [int] NULL,
 CONSTRAINT [PK_DeathTemp] PRIMARY KEY CLUSTERED 
(
	[DeathId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Game]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Game](
	[GameId] [int] IDENTITY(1,1) NOT NULL,
	[MapId] [int] NOT NULL,
	[GameTypeDesc] [nvarchar](50) NOT NULL,
	[WhenPlayed] [datetime] NOT NULL,
	[RedScore] [int] NULL,
	[BlueScore] [int] NULL,
	[GameTypeId] [int] NULL,
 CONSTRAINT [PK_Game] PRIMARY KEY CLUSTERED 
(
	[GameId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[GameType]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[GameType](
	[GameTypeId] [int] NOT NULL,
	[Description] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_GameType] PRIMARY KEY CLUSTERED 
(
	[GameTypeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Item_Player]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Item_Player](
	[ItemPlayerId] [int] IDENTITY(1,1) NOT NULL,
	[ItemId] [int] NOT NULL,
	[PlayerId] [int] NOT NULL,
	[RetrievalDate] [datetime] NOT NULL,
 CONSTRAINT [PK_Item_Player] PRIMARY KEY CLUSTERED 
(
	[ItemPlayerId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Map]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Map](
	[MapId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
	[Title] [nvarchar](255) NOT NULL,
	[FileName] [nvarchar](255) NOT NULL,
	[Picture] [image] NULL,
 CONSTRAINT [PK_Map] PRIMARY KEY CLUSTERED 
(
	[MapId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Player]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Player](
	[PlayerId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_Player] PRIMARY KEY CLUSTERED 
(
	[PlayerId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[RealName]    Script Date: 08/24/2010 15:44:29 ******/

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[RealName](
	[RealNameId] [int] IDENTITY(1,1) NOT NULL,
	[RealName] [varchar](255) NOT NULL,
 CONSTRAINT [PK_RealName] PRIMARY KEY CLUSTERED 
(
	[RealNameId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[RealName_Player]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[RealName_Player](
	[PlayerId] [int] NOT NULL,
	[RealNameId] [int] NOT NULL,
 CONSTRAINT [PK_RealName_Player] PRIMARY KEY CLUSTERED 
(
	[PlayerId] ASC,
	[RealNameId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Score]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Score](
	[ScoreId] [int] IDENTITY(1,1) NOT NULL,
	[PlayerId] [int] NOT NULL,
	[GameId] [int] NOT NULL,
	[Score] [int] NOT NULL,
	[Team] [nvarchar](50) NULL,
	[TimeScored] [datetime] NULL,
 CONSTRAINT [PK_Score] PRIMARY KEY CLUSTERED 
(
	[ScoreId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Weapon]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Weapon](
	[WeaponId] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_Weapon] PRIMARY KEY CLUSTERED 
(
	[WeaponId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Item]    Script Date: 08/24/2010 15:44:29 ******/

CREATE TABLE [dbo].[Item](
	[ItemId] [int] IDENTITY(1,1) NOT NULL,
	[Description] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_Item] PRIMARY KEY CLUSTERED 
(
	[ItemId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Death]  WITH CHECK ADD  CONSTRAINT [FK_Death_Game] FOREIGN KEY([GameId])
REFERENCES [dbo].[Game] ([GameId])
GO

ALTER TABLE [dbo].[Death] CHECK CONSTRAINT [FK_Death_Game]
GO

ALTER TABLE [dbo].[Death]  WITH CHECK ADD  CONSTRAINT [FK_Death_Player2] FOREIGN KEY([KillerId])
REFERENCES [dbo].[Player] ([PlayerId])
GO

ALTER TABLE [dbo].[Death] CHECK CONSTRAINT [FK_Death_Player2]
GO

ALTER TABLE [dbo].[Death]  WITH CHECK ADD  CONSTRAINT [FK_Death_Player3] FOREIGN KEY([VictimId])
REFERENCES [dbo].[Player] ([PlayerId])
GO

ALTER TABLE [dbo].[Death] CHECK CONSTRAINT [FK_Death_Player3]
GO

ALTER TABLE [dbo].[Death]  WITH CHECK ADD  CONSTRAINT [FK_Death_Weapon1] FOREIGN KEY([WeaponId])
REFERENCES [dbo].[Weapon] ([WeaponId])
GO

ALTER TABLE [dbo].[Death] CHECK CONSTRAINT [FK_Death_Weapon1]
GO

ALTER TABLE [dbo].[Game]  WITH CHECK ADD  CONSTRAINT [FK_Game_GameType] FOREIGN KEY([GameTypeId])
REFERENCES [dbo].[GameType] ([GameTypeId])
GO

ALTER TABLE [dbo].[Game] CHECK CONSTRAINT [FK_Game_GameType]
GO

ALTER TABLE [dbo].[Game]  WITH CHECK ADD  CONSTRAINT [FK_Game_Map] FOREIGN KEY([MapId])
REFERENCES [dbo].[Map] ([MapId])
GO

ALTER TABLE [dbo].[Game] CHECK CONSTRAINT [FK_Game_Map]
GO

ALTER TABLE [dbo].[Item_Player]  WITH CHECK ADD  CONSTRAINT [FK_Item_Player_Item] FOREIGN KEY([ItemId])
REFERENCES [dbo].[Item] ([ItemId])
GO

ALTER TABLE [dbo].[Item_Player] CHECK CONSTRAINT [FK_Item_Player_Item]
GO

ALTER TABLE [dbo].[Item_Player]  WITH CHECK ADD  CONSTRAINT [FK_Item_Player_Player] FOREIGN KEY([PlayerId])
REFERENCES [dbo].[Player] ([PlayerId])
GO

ALTER TABLE [dbo].[Item_Player] CHECK CONSTRAINT [FK_Item_Player_Player]
GO

ALTER TABLE [dbo].[RealName_Player]  WITH CHECK ADD  CONSTRAINT [FK_RealName_Player_Player] FOREIGN KEY([PlayerId])
REFERENCES [dbo].[Player] ([PlayerId])
GO

ALTER TABLE [dbo].[RealName_Player] CHECK CONSTRAINT [FK_RealName_Player_Player]
GO

ALTER TABLE [dbo].[RealName_Player]  WITH CHECK ADD  CONSTRAINT [FK_RealName_Player_RealName] FOREIGN KEY([RealNameId])
REFERENCES [dbo].[RealName] ([RealNameId])
GO

ALTER TABLE [dbo].[RealName_Player] CHECK CONSTRAINT [FK_RealName_Player_RealName]
GO

ALTER TABLE [dbo].[Score]  WITH CHECK ADD  CONSTRAINT [FK_Score_Game] FOREIGN KEY([GameId])
REFERENCES [dbo].[Game] ([GameId])
GO

ALTER TABLE [dbo].[Score] CHECK CONSTRAINT [FK_Score_Game]
GO

ALTER TABLE [dbo].[Score]  WITH CHECK ADD  CONSTRAINT [FK_Score_Player] FOREIGN KEY([PlayerId])
REFERENCES [dbo].[Player] ([PlayerId])
GO

ALTER TABLE [dbo].[Score] CHECK CONSTRAINT [FK_Score_Player]
GO

ALTER TABLE [dbo].[Weapon] ADD  CONSTRAINT [DF_Weapon_Description]  DEFAULT (N'CHUCKLES') FOR [Description]
GO